package com.slz3.business.module.versions;

import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicate;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RequestPredicates.accept;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;

public class VersionsRouter {

    private static RequestPredicate APPLICATION_JSON_UTF8 = accept(MediaType.APPLICATION_JSON_UTF8);

    public static RouterFunction<ServerResponse> funs(VersionsHandler handler) {
        return route(GET("/number/").and(APPLICATION_JSON_UTF8), handler::number);
    }

}
